|
|
|
|
|
|
|
(table continued from previous page) |
|
|
|
|
| Property | Description | | BuddyProperty | This identifies the name of the property to affect when the up or down arrow is clicked. | | SyncBuddy | You must set this property to True to have the control automatically affect the BuddyControl property. | | Increment | This is the amount you want to use to increment or decrement the value in the BuddyControl property. | | Orientation | You can have the UpDown control display either an up/down arrow or a left/right arrow. |
|
|
|
|
|
|
In the example, the Salary text box has no code because it uses a numeric value. You use the AutoBuddy feature of the UpDown control to have the UpDown control affect the salary in the text box. |
|
|
|
|
|
|
|
|
For the Birth Date text box, you need to write a little code to have the UpDown control affect the date in that text box: |
|
|
|
 |
|
|
|
|
Private Sub updDate_DownClick()
If IsDate(txtBirthDate.Text) Then
txtBirthDate.Text = CDate(txtBirthDate.Text) - _
updDate.Increment
End If
End Sub |
|
|
|
|
|
|
|
|
When the user clicks the down arrow, the DownClick event occurs. This event checks to see whether the Text property contains a valid date. If it does, it converts the value in the Text property to a date and decrements that value by the value in the Increment property of the UpDown control. |
|
|
|
|
|
|
|
|
When the user clicks the up arrow, the UpClick event occurs. The same steps are performed in this event, except it increments the value by the value in the Increment property of the UpDown control. Heres the code: |
|
|
|
 |
|
|
|
|
Private Sub updDate_UpClick()
If IsDate(txtBirthDate.Text) Then
txtBirthDate.Text = CDate(txtBirthDate.Text) + _
updDate.Increment
End If
End Sub |
|
|
|
|
|